<div class="main_content white_design" >
  <study-tab></study-tab>
  <div class="tab-content tab_content_with_fixed_header">
    <div class="sticky" #stickyHeader [ngClass]="{'fixed_header':fixedHeader}">
      <h2>{{studyConfig.title}}</h2>
        <ng-container *ngIf="studyConfig && studyConfig.tab">
          <div class="filter_line">
            <div class="filter_block" >
              <filter-generator *ngIf="filter.filterSchemaMain.lineLength" [schema]="filter.filterSchemaMain.schema" filterID="{{'study-filter-' + studyConfig.tab}}" [doNotSave]="[]" [model]="filter.filterModel" (submit)="search('current', $event)" [filterTreeHeight]="filter.filterSchemaMain.lineLength" (onChange)="filterChanged()" [defaultSubmitId]="'submit'" (onTemplateSet)="onFilterTemplateSet($event)" (onFilterClear)="onFilterClear($event)"></filter-generator>
            </div>
          </div>
          <div class="filter_line" [hidden]="!filter.expand">
            <div class="filter_block">
              <filter-generator *ngIf="filter.filterSchemaExpand.lineLength" [schema]="filter.filterSchemaExpand.schema" filterID="{{'study-filter-' + studyConfig.tab}}" [doNotSave]="[]" [model]="filter.filterModel" [filterTreeHeight]="filter.filterSchemaExpand.lineLength" (onChange)="filterChanged()" [defaultSubmitId]="'submit'" (onTemplateSet)="onFilterTemplateSet($event)"></filter-generator>
            </div>
          </div>
        </ng-container>
  </div>
      <div class="filter_line more_function_block" *ngIf="(studyConfig && (studyConfig.tab != 'mwl' && studyConfig.tab != 'mpps'))
                        || (studyWebService && studyWebService.selectedWebService
                            && !(studyConfig && (studyConfig.tab === 'diff' || studyConfig.tab === 'uwl' || studyConfig.tab === 'mpps')))
                        || (studyWebService && studyWebService.selectedWebService
                            && patients && patients.length > 0 && !(studyConfig && (studyConfig.tab === 'diff' || studyConfig.tab === 'uwl' || studyConfig.tab === 'mpps')))">
        <div class="filter single_block">
          <div class="filter_block" *ngIf="(studyConfig && studyConfig.tab != 'mwl')">
            <div class="line">
              <a href="" (click)="$event.preventDefault();filter.expand=true" *ngIf="!filter.expand" class="more pull-left" i18n="@@more">More<i class="glyphicon glyphicon-triangle-bottom"></i></a>
              <a href="" (click)="$event.preventDefault();filter.expand=false" *ngIf="filter.expand" class="more [hidden] pull-left" i18n="@@close_more_block">Close More Block<i class="glyphicon glyphicon-triangle-top"></i></a>
              <input *ngIf="patients && patients.length > 0"  i18n-title="@@title.study.search_current_list" title="Search current local list ( That's NOT searching in the Server! )" type="text" [(ngModel)]="searchCurrentList"  i18n-placeholder="@@placeholder.study.search_current_list" placeholder="Search current list">
            </div>
          </div>
          <div class="filter_block">
            <div class="line">
              <dcm-drop-down
                  [placeholder]="moreFunctionConfig.placeholder"
                  [options]="moreFunctionConfig.options | dynamicPipe:undefined:moreFunctionFilterPipe:internal:studyConfig"
                  [editable]="false"
                  [(model)]="moreFunctionConfig.model"
                  [showSearchField]="false"
                  [multiSelectMode]="false"
                  (modelChange)="moreFunctionChanged($event)"
                  [showStar]="false"
                  *ngIf="(studyWebService && studyWebService.selectedWebService && !(studyConfig && studyConfig.tab === 'diff'))"
                  [permission]="{id:'action-studies-more_function',param:'visible'}"
              ></dcm-drop-down>
              <dcm-drop-down
                      [placeholder]="actionsSelections.placeholder"
                      [options]="actionsSelections.options | dynamicPipe:undefined:actionsSelectionsFilterPipe:internal:trash.active:studyConfig"
                      [editable]="false"
                      [(model)]="actionsSelections.model"
                      [showSearchField]="false"
                      [multiSelectMode]="false"
                      (modelChange)="actionsSelectionsChanged($event)"
                      [showStar]="false"
                      *ngIf="studyWebService && studyWebService.selectedWebService && patients && patients.length > 0 && !(studyConfig && (studyConfig.tab === 'diff' || studyConfig.tab === 'uwl' || studyConfig.tab === 'mpps'))"
                      [permission]="{id:'action-studies-more_function',param:'visible'}"
              ></dcm-drop-down>
<!--              <dcm-drop-down
                   i18n-placeholder="@@placeholder.study.primary_aet" placeholder="Primary AET"
                  [options]="diffOptions.aes"
                  [editable]="false"
                  [(model)]="diffOptions.primaryAET"
                  [showSearchField]="false"
                  [multiSelectMode]="false"
                  (modelChange)="moreFunctionChanged($event)"
                  [showStar]="false"
                  *ngIf="studyConfig && studyConfig.tab === 'diff'"
                  [permission]="{id:'action-studies-more_function',param:'visible'}"
              ></dcm-drop-down>
              <dcm-drop-down
                       i18n-placeholder="@@placeholder.study.secondary_aet" placeholder="Secondary AET"
                      [options]="diffOptions.aes"
                      [editable]="false"
                      [(model)]="diffOptions.secondaryAET"
                      [showSearchField]="false"
                      [multiSelectMode]="false"
                      (modelChange)="actionsSelectionsChanged($event)"
                      [showStar]="false"
                      *ngIf="studyConfig && studyConfig.tab === 'diff'"
                      [permission]="{id:'action-studies-more_function',param:'visible'}"
              ></dcm-drop-down>-->
            </div>
          </div>
            <div class="filter_block" *ngIf="((patients && patients.length > 0) || (studyConfig && studyConfig.tab === 'diff'))">
                <div class="line">

                </div>
            </div>
        </div>
      </div>
    <div class="selection_actions" *ngIf="tableParam.config.showCheckboxes" [permission]="{id:'action-studies-copy_merge_move',param:'visible'}">
        <ul class="selection_functions">
            <li class="ignore_click_outside"><button class="ignore_click_outside" [ngClass]="{'active':checkboxFunctions}" (click)="selectionAction('checkbox_functions')"><i class="ignore_click_outside material-icons">playlist_add_check</i></button></li>
            <li><button [disabled]="selectedElements.action || selectedElements.preActionElements.getSpecificObjectSize('patient') > 0" (click)="selectionAction('copy')"  i18n-title="@@title.study.mark_selected_study_for_copy" title="Mark selected study for copy"><i class="material-icons">content_copy</i></button></li>
            <li><button [disabled]="selectedElements.action || selectedElements.preActionElements.getSpecificObjectSize('patient') > 0" (click)="selectionAction('move')"  i18n-title="@@title.study.mark_selected_study_for_move" title="Mark selected study for move"><i class="material-icons">content_cut</i></button></li>
            <li><button [disabled]="selectedElements.action || selectedElements.preActionElements.getSpecificObjectSize('patient') > 0" (click)="selectionAction('link')"  i18n-title="@@title.study.mark_selected_study_for_linking_with_mwl" title="Mark selected study for linking with MWL"><i class="material-icons">link</i></button></li>
            <li><button [disabled]="selectedElements.action" (click)="selectionAction('patient_merge')"  i18n-title="@@title.study.mark_selected_patient_for_merge" title="Mark selected patient for merge"><i class="material-icons">supervisor_account</i></button></li>
            <li><button (click)="selectionAction('paste')"  i18n-title="@@title.study.start_the_process_of_copieng_moving_linked_or_merge" title="Start the process of copying/moving/linking or merging"><i class="glyphicon glyphicon-paste"></i></button></li>
        </ul>
        <ul *ngIf="checkboxFunctions" class="checkbox_functions" (clickOutside)='checkboxFunctions = !checkboxFunctions' [clickOutsideExceptionClass]="['ignore_click_outside']">
            <li class="ignore_click_outside"><button class="ignore_click_outside" (click)="selectionAction('remove_selection')" i18n="@@remove_all_selections">Remove all selections</button></li>
            <li class="ignore_click_outside"><button class="ignore_click_outside" (click)="selectionAction('check_selection_study')" i18n="@@select_all_studies">Select all studies</button></li>
            <li class="ignore_click_outside"><button class="ignore_click_outside" (click)="selectionAction('uncheck_selection_study')" i18n="@@unselect_all_studies">Unselect all studies</button></li>
            <li class="ignore_click_outside"><button class="ignore_click_outside" (click)="selectionAction('check_selection_patient')" i18n="@@select_all_patients">Select all patients</button></li>
            <li class="ignore_click_outside"><button class="ignore_click_outside" (click)="selectionAction('uncheck_selection_patient')" i18n="@@unselect_all_patients">Unselect all patients</button></li>
            <li class="ignore_click_outside"><button class="ignore_click_outside" (click)="selectionAction('hide_checkboxes')" i18n="@@hide_checkboxes">Hide checkboxes</button></li>
        </ul>
    </div>
    <div class="left_arrow arrow"   i18n-title="@@title.preview_page" title="Preview page" *ngIf="patients" [ngClass]="{'active':filter.filterModel.offset > 0}" (click)="search('prev',{id:'submit'})"><span class="glyphicon glyphicon glyphicon-chevron-left"></span></div>
    <div class="right_arrow arrow"  i18n-title="@@title.next_page" title="Next page" *ngIf="patients" [ngClass]="{'active':more}" (click)="search('next',{id:'submit'})"><span class="glyphicon glyphicon glyphicon-chevron-right"></span></div>
    <dicom-studies-table [patients]="patients" [tableSchema]="tableParam.tableSchema" [config]="tableParam.config" [studyWebService]="studyWebService" (onPaginationClick)="onSubPaginationClick($event)" [searchList]="searchCurrentList"></dicom-studies-table>
  </div>
    <div id="clipboard" class="clipboard said"  *ngIf="selectedElements.preActionElements && selectedElements.preActionElements.size > 0 && selectedElements.action">
        <div id="clipboardtoggle" class="toggle_button" (click)="showClipboardContent = !showClipboardContent">
            <i id="clipboardtoggle_icon" class="glyphicon glyphicon-copy"></i>
        </div>
        <div class="content" id="clipboard_content" *ngIf="showClipboardContent">
            <h5 i18n="@@selected_objects_to_action">Selected Objects to {{selectedElements.action}}</h5>
            <a class="clear_clipboard"  i18n-title="@@title.study.clear_clipboard" title="Clear clipboard" href="" (click)="$event.preventDefault();clearClipboard()">
                Clear <span class="glyphicon glyphicon-remove"></span>
            </a>
            <div class="table_block">
                <ng-container  *ngFor="let level of ['patient','study','series','instance']">
                    <selections-dicom-view *ngIf="selectedElements.preActionElements[level] && Object.keys(selectedElements.preActionElements[level]) && Object.keys(selectedElements.preActionElements[level]).length > 0" [selectionsDicomObjects]="selectedElements.preActionElements[level]" [dicomLevel]="level" (onRemoveFromSelection)="onRemoveFromSelection($event)"></selections-dicom-view>
                </ng-container>
            </div>
        </div>
    </div>
</div>